package com.one.shopping.adapter;

import android.content.Context;

import com.one.shopping.R;
import com.one.shopping.api.OneApi;
import com.one.shopping.entity.Goods;

/**
 * @author 柯尊诚
 * @version 1.0
 * @date 创建时间：2016/1/9 9:56
 */
public class GoodsAdapter extends CommonAdapter<Goods>{

    public GoodsAdapter(Context context, int layoutId) {
        super(context, layoutId);
    }

    @Override
    protected void convert(final ViewHolder vh, final Goods goods) {
        vh.setText(R.id.goods_list_name_tv, goods.getName());
        vh.setText(R.id.goods_list_price_tv, "" + goods.getPrice());
        vh.setText(R.id.goods_list_stock_tv, "" + goods.getStock());
        vh.setImageForUrl(R.id.goods_list_image_iv, OneApi.IMAGE_URL + goods.getImage());
    }
}
